package com.gitee.wsl.compose.ui.swiperefresh.state

/**
 * A normal process is: IDLE -> Dragging -> ReadyForAction -> ActionInProgress -> ActionSuccess/ActionFailed -> Resetting -> IDLE
 */
enum class ActionStatus {
    IDLE,
    Dragging,
    ReadyForAction,
    InProgress,
    Success,
    Failed,
    Resetting;

    val isResetting: Boolean
        get() = this == Resetting

    val isFinishing: Boolean
        get() = this == Success || this == Failed || this == Resetting

    val isLoading:Boolean
        get() = this == InProgress

    val canAcceptScroll: Boolean
        get() = this == IDLE || this == Dragging || this == ReadyForAction

    val shouldRejectScroll: Boolean
        get() = this == InProgress || this == Success || this == Failed || this == Resetting
}